package com.example.paopao.consumer.memer.service.impl;

import com.example.paopao.consumer.memer.dao.persist.repository.UserAlterRepository;
import com.example.paopao.consumer.memer.pojo.dto.UserAlterInfoDTO;
import com.example.paopao.consumer.memer.pojo.entity.User;
import com.example.paopao.consumer.memer.service.IUserAlterService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserAlterService implements IUserAlterService {

    @Autowired
    private UserAlterRepository userAlterRepository;

    @Override
    public int userAlterInfo(UserAlterInfoDTO userAlterInfoDTO) {

        User user=new User();
        BeanUtils.copyProperties(userAlterInfoDTO,user);
        user.setUpdateTime(new Date());

        return userAlterRepository.userAlterInfo(user);
    }
}
